setwd("E:/")
library(ENMTools)
library(raster)
env <- raster::getData('worldclim', var='bio', res=10)
env <- crop(env, extent(-10, 17, 39, 48))
plot(env[[1]])
monticola.path <- paste(system.file(package="ENMTools"), "/monticola.csv", sep='')
monticola <- enmtools.species(species.name = "monticola",
presence.points = read.csv(monticola.path))
monticola$range <- background.raster.buffer(monticola$presence.points, 50000, mask = env)
monticola$background.points <- background.points.buffer(points = monticola$presence.points,
radius = 20000, n = 1000, mask = env[[1]])
monticola.glm <- enmtools.glm(species = monticola, env = env, f = pres ~ bio1 + bio12 + bio7, test.prop = 0.2)
data(iberolacerta.clade)
data(euro.worldclim)
monticola <- iberolacerta.clade$species$monticola
plot(monticola)
library(rgbif)
library(ape)
tree.path <- paste(system.file(package="ENMTools"), "/StarBEAST_MCC.species.txt", sep='')
hisp.anoles <- read.nexus(file = tree.path)
keepers <- c("brevirostris", "marron", "caudalis", "websteri", "distichus")
hisp.anoles <- drop.tip(phy = hisp.anoles, tip = hisp.anoles$tip.label[!hisp.anoles$tip.label %in% keepers])
plot(hisp.anoles)
hisp.anoles$tip.label
install.packages("ggtree")
library(ggtree)
file <- system.file("extdata/BEAST", "beast_mcc.tree", package="ggtree")
beast <- read.beast(file)
beast
get.fields(beast)
ggtree(beast, ndigits = 2, branch.length = 'none') + geom_text(aes(x = branch, label = length_0.95_HPD), vjust = -.5, color = 'firebrick')
beast_data <- fortify(beast)
head(beast_data)
brstfile <- system.file("extdata/PAML_Baseml", "rst", package="ggtree")
brst <- read.paml_rst(brstfile)
brst
p <- ggtree(brst) +
geom_text(aes(x = branch, label = marginal_AA_subs), vjust=-.5, color='steelblue') +
theme_tree2()
print(p)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("ggtree")
library(ggtree)
set.seed(2017-02-16)
tree <- rtree(50)
library(rgbif)
library(ape)
tree.path <- paste(system.file(package="ENMTools"), "/StarBEAST_MCC.species.txt", sep='')
hisp.anoles <- read.nexus(file = tree.path)
keepers <- c("brevirostris", "marron", "caudalis", "websteri", "distichus")
hisp.anoles <- drop.tip(phy = hisp.anoles, tip = hisp.anoles$tip.label[!hisp.anoles$tip.label %in% keepers])
plot(hisp.anoles)
hisp.anoles$edge
hisp.anoles$edge.length